/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package pw.yitree.game;

/**
 *
 * @author Administrator
 */
public enum Game {

    ZTHJ("zthj"),
    ASKTAO("asktao");

    private final String code;

    Game(String code) {
        this.code = code;
    }

    public static Game fromCode(String code) {
        if (code == "zthj" || code == "ZTHJ") {
            return ZTHJ;
        }
        if (code == "asktao" || code == "ASKTAO") {
            return ASKTAO;
        }
        throw new UnsupportedOperationException(
                "The code " + code + " is not supported!"
        );
    }

    public String getCode() {
        return code;
    }
}
